package org.ykh.srb.core.pojo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * <p>
 * 数据字典
 * </p>
 *
 * @author ykh
 * @since 2024-03-12
 */
@Getter
@Setter
@TableName("dict")
@Schema(name = "DictEntity", description = "数据字典")
public class DictEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(description = "id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Schema(description = "上级id")
    @TableField("parent_id")
    private Long parentId;

    @Schema(description = "名称")
    @TableField("name")
    private String name;

    @Schema(description = "值")
    @TableField("value")
    private Integer value;

    @Schema(description = "编码")
    @TableField("dict_code")
    private String dictCode;

    @Schema(description = "创建时间")
    @TableField("create_time")
    @DateTimeFormat
    @JsonFormat
    private LocalDateTime createTime;

    @Schema(description = "更新时间")
    @TableField("update_time")
    @DateTimeFormat
    @JsonFormat
    private LocalDateTime updateTime;

    @Schema(description = "删除标记（0:不可用 1:可用）")
    @TableField("is_deleted")
    @TableLogic
    private Boolean deleted;

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("DictEntity{");
        sb.append("id=").append(id);
        sb.append(", parentId=").append(parentId);
        sb.append(", name='").append(name).append('\'');
        sb.append(", value=").append(value);
        sb.append(", dictCode='").append(dictCode).append('\'');
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", deleted=").append(deleted);
        sb.append('}');
        return sb.toString();
    }
}
